﻿using AccessCompare;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AccessDBCompare
{
    public partial class AccessDbCompareMain : Form
    {
        TreeViewBuilder _treeViewBuilder;

        public AccessDbCompareMain()
        {
            InitializeComponent();
        }

        private void btnBrowseSource_Click(object sender, EventArgs e)
        {

            if(ofdSource.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                txtSource.Text = ofdSource.FileName;
            }
        }

        private void btnBrowseDestination_Click(object sender, EventArgs e)
        {
            if (ofdSource.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                txtDestination.Text = ofdSource.FileName;
            }
        }

        private void btnCompare_Click(object sender, EventArgs e)
        {

            if (string.IsNullOrEmpty(txtSource.Text))
            {
                MessageBox.Show("Please select source databse!");
                return;
            }

            if (string.IsNullOrEmpty(txtDestination.Text))
            {
                MessageBox.Show("Please select desination databse!");
                return;
            }

            _treeViewBuilder = new TreeViewBuilder(txtSource.Text, txtDestination.Text);

            _treeViewBuilder.FillTreeViews(twSource, twDestination);
        }

        private void AccessDbCompareMain_Load(object sender, EventArgs e)
        {

        }

        private void splitContainer1_Panel1_Paint(object sender, PaintEventArgs e)
        {

        }
    }
}
